package com.acsior.hibernate.vo;

import static javax.persistence.InheritanceType.JOINED;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * Customer entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "customers")
@Inheritance(strategy = JOINED)
@GeneratorKey(tableName = "customers")
public class CustomerVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 8900779253366338393L;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<AddressVO> addresses;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<BankAccountVO> bankAccounts;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<CommunicationVO> communications;

	@Column(name = "dds_id", length = 20)
	private String ddsId;

	@Column(name = "first_name", nullable = false)
	private String firstName;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<IdCardVO> idCards;

	@Column(name = "id_number", length = 20)
	private String idNumber;

	@Column(name = "last_name", length = 100)
	private String lastName;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<LetterOfAttorneyVO> letterOfAttorneys;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_id_type_id", nullable = false)
	private NomIdTypeVO nomIdType;

	@Column(name = "surname", length = 100)
	private String surname;

	/** default constructor */
	public CustomerVO() {
		this.addresses = new ArrayList<AddressVO>();
		this.idCards = new ArrayList<IdCardVO>();
		this.communications = new ArrayList<CommunicationVO>();
		this.letterOfAttorneys = new ArrayList<LetterOfAttorneyVO>();
		this.bankAccounts = new ArrayList<BankAccountVO>();
	}

	/** @return the addresses */
	public List<AddressVO> getAddresses() {
		return this.addresses;
	}

	/** @return the bankAccounts */
	public List<BankAccountVO> getBankAccounts() {
		return this.bankAccounts;
	}

	/** @return the communications */
	public List<CommunicationVO> getCommunications() {
		return this.communications;
	}

	/** @return the ddsId */
	public String getDdsId() {
		return this.ddsId;
	}

	/** @return the firstName */
	public String getFirstName() {
		return this.firstName;
	}

	/** @return the idCards */
	public List<IdCardVO> getIdCards() {
		return this.idCards;
	}

	/** @return the idNumber */
	public String getIdNumber() {
		return this.idNumber;
	}

	/** @return the lastName */
	public String getLastName() {
		return this.lastName;
	}

	/** @return the letterOfAttorneys */
	public List<LetterOfAttorneyVO> getLetterOfAttorneys() {
		return this.letterOfAttorneys;
	}

	/** @return the nomIdType */
	public NomIdTypeVO getNomIdType() {
		return this.nomIdType;
	}

	/** @return the surname */
	public String getSurname() {
		return this.surname;
	}

	/**
	 * @param addresses
	 *            the addresses to set
	 */
	public void setAddresses(List<AddressVO> addresses) {
		this.addresses = addresses;
	}

	/**
	 * @param bankAccounts
	 *            the bankAccounts to set
	 */
	public void setBankAccounts(List<BankAccountVO> bankAccounts) {
		this.bankAccounts = bankAccounts;
	}

	/**
	 * @param communications
	 *            the communications to set
	 */
	public void setCommunications(List<CommunicationVO> communications) {
		this.communications = communications;
	}

	/**
	 * @param ddsId
	 *            the ddsId to set
	 */
	public void setDdsId(String ddsId) {
		this.ddsId = ddsId;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @param idCards
	 *            the idCards to set
	 */
	public void setIdCards(List<IdCardVO> idCards) {
		this.idCards = idCards;
	}

	/**
	 * @param idNumber
	 *            the idNumber to set
	 */
	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @param letterOfAttorneys
	 *            the letterOfAttorneys to set
	 */
	public void setLetterOfAttorneys(List<LetterOfAttorneyVO> letterOfAttorneys) {
		this.letterOfAttorneys = letterOfAttorneys;
	}

	/**
	 * @param nomIdType
	 *            the nomIdType to set
	 */
	public void setNomIdType(NomIdTypeVO nomIdType) {
		this.nomIdType = nomIdType;
	}

	/**
	 * @param surname
	 *            the surname to set
	 */
	public void setSurname(String surname) {
		this.surname = surname;
	}
}